import React, { Component } from 'react';
import { Form, Input, Button } from 'antd';
import { connect } from 'dva';
@Form.create()
@connect(({ buyoutes }) => ({ buyoutes }))
export default class Notecontent extends Component {
    handleSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                this.onRequest(values);
            }
        });
    }
    onRequest = (values) => {
        const { dispatch } = this.props;
        dispatch({
            type: 'buyoutes/pushRemark',
            payload: {
                orderId: sessionStorage.getItem('uid'),
                remark: values.note
            },
            callback: (res) => {
                // console.log(res, 'res')
                this.props.handleCancel();
                 location.reload();
            }
        })
    }
    render() {
        const { getFieldDecorator } = this.props.form;
        const { TextArea } = Input;
        return (
            <div>
                <Form onSubmit={this.handleSubmit}>
                    <Form.Item>
                        {
                            getFieldDecorator('note')(
                                <TextArea />
                            )
                        }
                    </Form.Item>
                    <div style={{ width: '100%', textAlign: 'right' }}>
                        <Button type='primary' htmlType='submit'>确定</Button>
                    </div>
                </Form>
            </div>
        )
    }
}